package com.czxy.controller;

import com.czxy.dao.CommodityDao;
import com.czxy.domain.Suggest;
import com.czxy.service.SuggestService;
import com.czxy.vo.BaseResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhangmengxiang1@itcast.cn
 * @version 1.0
 * @date 2020/2/11
 */
@RestController
@RequestMapping("/suggest")
public class SuggestController {
    @Resource
    private SuggestService suggestService;

    //建议 添加
    @PostMapping("/addSuggest")
    public BaseResult addSuggest(@RequestBody Suggest suggest){
        suggestService.addSuggest(suggest);
        return BaseResult.ok("添加成功");
    }

    //建议 查询
    @GetMapping("/findAllguest")
    public BaseResult findAllguest(){
        List<Suggest> suggestList = suggestService.findAllguest();
        return BaseResult.ok("查询成功",suggestList);
    }

    //建议 删除
    @DeleteMapping("/delBysid/{sid}")
    public BaseResult delBysid(@PathVariable("sid") Integer sid){
        suggestService.delBysid(sid);
        return BaseResult.ok("删除成功");
    }



}
